package com.qf.smsplatform.webmaster.service.impl;

import com.qf.smsplatform.webmaster.constans.ResultCode;
import com.qf.smsplatform.webmaster.exceptions.MyBaseException;
import com.qf.smsplatform.webmaster.mapper.DirtywordMapper;
import com.qf.smsplatform.webmaster.pojo.TDirtyword;
import com.qf.smsplatform.webmaster.service.DirtywordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;

@Service
@Transactional
public class DirtywordServiceImpl implements DirtywordService {
    @Autowired
    private DirtywordMapper dirtywordMapper;


    @Override
    public TDirtyword findDirtyById(Long id) {

        if (ObjectUtils.isEmpty(id) || id <= 0) {
            //就应该抛出异常
            //抛一个自定义的异常
            throw new MyBaseException("传递的主键不合法", ResultCode.PK_NOT_ALLOW);
        }
        return dirtywordMapper.findDirtyById(id);
    }
}
